import request from "@/utils/request";
export interface GoodsType {
    _id: string;
    title: string;
    description: string;
    status: number;
}
export interface GoodsTypeAttribute {
    _id: string;
    goods_type_id: string;
    title: string;
    attr_type: string;
    attr_value: string;
    status: number;
}
export interface GoodsCate {
    _id: string;
    title: string;
    cate_img: string;
    link: string;
    template: string;
    pid: string;
    sub_title: string;
    keywords: string;
    description: string;
    status: number;
    sort: number;
    main_cate_list: string[];
}
export interface Goods {
    _id: string;
    title: string;
    sub_title: string;
    goods_sn: string;
    cate_id: string;
    click_count: number;
    goods_number: number;
    shop_price: number;
    market_price: number;
    relation_goods: string;
    more_attrs: string;
    goods_version: string;
    goods_img: string;
    goods_gift: string;
    goods_fitting: string;
    goods_color: string[];
    goods_keywords: string;
    goods_desc: string;
    goods_content: string;
    sort: number;
    is_delete: number;
    is_hot: number;
    is_best: number;
    is_new: number;
    goods_type_id: number;
    status: number;
}

export interface GoodsColor {
    color_name: string;
    color_value: string;
    status: number;
}

export interface GoodsAttr {
    _id: string;
    goods_id: string;
    goods_cate_id: string;
    attribute_cate_id: string;
    attribute_id: string;
    attribute_type: string;
    attribute_title: string;
    attribute_value: string;
    status: number;
}

export interface GoodsImage {
    _id: string;
    goods_id: string;
    img_url: string;
    color_id: string;
    status: number;
    sort: number;
}

export interface GoodsNav {
    _id: string;
    title: string;
    link: string;
    position: number;
    is_opennew: number;
    sort: number;
    relation: string[];
    status: number;
}

export const getGoodsTypeApi = (goodsTypeInfo: Partial<GoodsType>) => request.get("/admin/goodsType", { params: goodsTypeInfo });
export const createGoodsTypeApi = (goodsTypeInfo: Partial<GoodsType>) => request.post("/admin/goodsType", goodsTypeInfo);
export const updateGoodsTypeApi = (goodsTypeInfo: Partial<GoodsType>) => request.patch("/admin/goodsType", goodsTypeInfo);
export const deleteGoodsTypeApi = (goodsTypeInfo: Partial<GoodsType>) => request.delete("/admin/goodsType", { data: goodsTypeInfo });

export const getGoodsTypeAttributeApi = (goodsTypeAttributeInfo: Partial<GoodsTypeAttribute>) =>
    request.get("/admin/goodsTypeAttribute", { params: goodsTypeAttributeInfo });
export const createGoodsTypeAttributeApi = (goodsTypeAttributeInfo: Partial<GoodsTypeAttribute>) =>
    request.post("/admin/goodsTypeAttribute", goodsTypeAttributeInfo);
export const updateGoodsTypeAttributeApi = (goodsTypeAttributeInfo: Partial<GoodsTypeAttribute>) =>
    request.patch("/admin/goodsTypeAttribute", goodsTypeAttributeInfo);
export const deleteGoodsTypeAttributeApi = (goodsTypeAttributeInfo: Partial<GoodsTypeAttribute>) =>
    request.delete("/admin/goodsTypeAttribute", { data: goodsTypeAttributeInfo });

export const getGoodsCateApi = (goodsCateInfo?: Partial<GoodsCate>) => request.get("/admin/goodsCate", { params: goodsCateInfo });
export const createGoodsCateApi = (goodsCateInfo: Partial<GoodsCate>) => request.post("/admin/goodsCate", goodsCateInfo);
export const updateGoodsCateApi = (goodsCateInfo: Partial<GoodsCate>) => request.patch("/admin/goodsCate", goodsCateInfo);
export const deleteGoodsCateApi = (goodsCateInfo: Partial<GoodsCate>) => request.delete("/admin/goodsCate", { data: goodsCateInfo });

export const getGoodsApi = (goodsInfo?: Partial<Goods>) => request.get("/admin/goods", { params: goodsInfo });
export const createGoodsApi = (goodsInfo: Partial<Goods>) => request.post("/admin/goods", goodsInfo);
export const updateGoodsApi = (goodsInfo: Partial<Goods>) => request.patch("/admin/goods", goodsInfo);
export const deleteGoodsApi = (goodsInfo: Partial<Goods>) => request.delete("/admin/goods", { data: goodsInfo });

export const getGoodsColorApi = (goodsColorInfo?: Partial<GoodsColor>) => request.get("/admin/goodsColor", { params: goodsColorInfo });
export const createGoodsColorApi = (goodsColorInfo: Partial<GoodsColor>) => request.post("/admin/goodsColor", goodsColorInfo);
export const updateGoodsColorApi = (goodsColorInfo: Partial<GoodsColor>) => request.patch("/admin/goodsColor", goodsColorInfo);
export const deleteGoodsColorApi = (goodsColorInfo: Partial<GoodsColor>) => request.delete("/admin/goodsColor", { data: goodsColorInfo });

export const getGoodsImageApi = (goodsImageInfo?: Partial<GoodsImage>) => request.get("/admin/goodsImage", { params: goodsImageInfo });

export const getGoodsNavApi = (goodsNavInfo?: Partial<GoodsNav>) => request.get("/admin/nav", { params: goodsNavInfo });
export const createGoodsNavApi = (goodsNavInfo: Partial<GoodsNav>) => request.post("/admin/nav", goodsNavInfo);
export const updateGoodsNavApi = (goodsNavInfo: Partial<GoodsNav>) => request.patch("/admin/nav", goodsNavInfo);
export const deleteGoodsNavApi = (goodsNavInfo: Partial<GoodsNav>) => request.delete("/admin/nav", { data: goodsNavInfo });
